﻿<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="375" MadCap:lastWidth="902">
    <head>
    </head>
    <body>
        <h1>Interface Based Programming</h1>
        <p>The root cause of DLL Hell is the lack of binary compatibility between objects sharing the same public methods and data.  What we would like to do is create an object in C++ with a standard set of methods and completely isolate the consumers of this object from the underlying implementation, not just at build-time but at runtime as well. This would allow us to change the implementation of our object without breaking the programs that use it. We should be free to change not just the internal structure of the object, but also the tools we use to build it. The dissemination of such changes should only require us only to distribute a new DLL. It should not be necessary to rebuild all the applications that use our DLL each time a new version is released.</p>
        <p>Although the C++ standard doesn’t support the binary encapsulation of objects, it is possible to create one (concrete) class for the implementation of an object and a different (abstract) class for defining the public methods of an object. Furthermore, the pure virtual functions used to define the abstract class can provide a binary compatible interface between the library containing the object and the application that uses it. Therefore, if we describe our object to an application program only in terms of it implementing a given abstract class, then we can achieve our goal of creating a C++ plugin library containing objects whose implementation can be changed without the need to rebuild the applications that use them.</p>
        <p>The separation of interface from implementation is the foundation of interface based programming. It also lies at the heart of MxPlugin. However, there a few other matters that must be resolved before we can propose a practical solution.</p>
        <p>Note: These interfaces address the problem of an application crashing or aborting because a replacement DLL is not compatibility with its predecessor at a binary level. However, it does not stop bugs arising in the application due to differences in the contract implemented by the new DLL</p>
    </body>
</html>